<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>团体认证</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script src="../js/base.js"></script>
    <script src="../js/jquery.min.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>

    </style>
</head>

<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <input id="id" type="hidden" data-id="id">
            <div class="layui-form-item">
                <label for="enterpriseName" class="layui-form-label">
                    名称
                </label>
                <div class="layui-input-inline">
                    <div id="enterpriseName"
                         style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;"
                         data-id="">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="enterpriseEmail" class="layui-form-label">
                    住所
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="enterpriseAddress"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="enterpriseAddress" class="layui-form-label">
                    法定代表人
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="legalRepresentative"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="postcodes" class="layui-form-label">
                    注册资金
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="registeredFund"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    统一社会信用代码
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="businessLicenseNo"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    法人身份证号
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="legalPersonIdCard"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseImg" class="layui-form-label">
                    法人身份证正面照片
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <img src="" id="idCardFrontUrl" style="width: 100%;height: 100%">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseImg" class="layui-form-label">
                    法人身份证反面照片
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <img src="" id="idCardReverseUrl" style="width: 100%;height: 100%">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    联系人
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="linkman"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    固定电话
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="fixationTel"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    联系电话
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="linkTel"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    业务范围
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="businessLine"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    活动区域
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="movementArea"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    业务主管单位
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="competentOrganization"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    社会团体法人登记证书
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <img src="" id="organizationinCorporationCertificateUrl" style="width: 100%;height: 100%">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="businessLicenseNo" class="layui-form-label">
                    有效期
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <div id="validityDate"
                             style="border: 1px solid #e6e6e6;padding-left: 6px;line-height: 38px;height: 38px;cursor: not-allowed;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="status" class="layui-form-label">
                    <span class="x-red">*</span>认证结果
                </label>
                <div class="layui-input-block">
                    <input type="radio" lay-filter="isPassTest" name="isPassTest" id="isPassTest1" value="1"
                           title="通过">
                    <div class="layui-unselect layui-form-radio layui-form-radioed">
                        <div>通过</div>
                    </div>
                    <input type="radio" lay-filter="isPassTest" name="isPassTest" id="isPassTest2" value="2"
                           title="失败">
                    <div class="layui-unselect layui-form-radio">
                        <div>失败</div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" id="reasonDiv" style="display: none">
                <label for="businessLicenseNo" class="layui-form-label">
                    失败原因
                </label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline">
                        <input type="text" value="" id="reason" class="layui-input" placeholder="请输入失败原因">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="text-align: center">
                <button type="submit" lay-filter="add" lay-submit="" class="layui-btn">确定</button>
                <button type="button" class="layui-btn layui-btn-primary" onclick="xadmin.close()">取消</button>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['form', 'layer', 'laydate'],
        function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#date', //指定元素
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm'
            });

            form.on('radio(isPassTest)', function (data) {
                console.log(data.value); //被点击的radio的value值
                if (data.value == '2') {
                    $("#reasonDiv").css("display", "block");
                } else {
                    $("#reasonDiv").css("display", "none");
                }
            });


            //监听提交
            form.on('submit(add)',
                function (data) {
                    //获取到表单信息
                    var isPassTest = ""; //是否通过
                    var id = $("#id").val();
                    isPassTest = data.field.isPassTest; //获取是否通过
                    console.log(isPassTest)
                    if (isPassTest == 2) {
                        if ($("#reason").val() == "") {
                            layer.alert("请填写失败原因")
                            return false;
                        }
                    }
                    //发异步，发数据
                    $.ajax({
                        type: "get",
                        url: authUserInfo,
                        data: {
                            id: id,
                            status: isPassTest,
                            reason: $("#reason").val()
                        },
                        success: function (res) {
                            console.log(res)
                            if (res.msg == 0) {
                                layer.alert("操作成功", {
                                    icon: 6
                                }, function () {
                                    //关闭当前frame
                                    xadmin.close();
                                    // 可以对父窗口进行刷新
                                    xadmin.father_reload();
                                });
                            } else {
                                layer.alert(res.msg, function (index) {
                                    if (res.msg == "session已失效，请重新登录") {
                                        parent.parent.window.location.href =
                                            getRequestPrefix() +
                                            "/footBallAdmin/login.html"
                                        xadmin.close();
                                    } else {
                                        layer.close(index);
                                    }
                                });
                            }
                        },
                        error: function (error) {
                            console.log(error)
                        }
                    })
                    return false;
                });

        });
</script>
</body>

</html>